﻿using System.IO;

namespace OpenLS.Spreadsheet.Formats.Biff.Records
{
    internal class PictFmlaKey
    {
        private ObjFmla _fmlaLinkedCell;
        private ObjFmla _fmlaListFillRange;
        private byte[] _keyBuf;

        public void Read(BinaryReader reader)
        {
            int cbKey = reader.ReadInt32();
            _keyBuf = reader.ReadBytes(cbKey);
            _fmlaLinkedCell = new ObjFmla();
            _fmlaLinkedCell.Read(reader, false);
            _fmlaListFillRange = new ObjFmla();
            _fmlaListFillRange.Read(reader, false);
        }

        public void Write(BinaryWriter writer)
        {
            writer.Write(_keyBuf.Length);
            writer.Write(_keyBuf);
            _fmlaLinkedCell.Write(writer);
            _fmlaListFillRange.Write(writer);
        }
    }
}